/* global window */
import modelExtend from 'dva-model-extend'
import { pathMatchRegexp } from 'utils'
import {queryPartDataList} from 'api'
import { DataListModel } from 'utils/model'

export default modelExtend(DataListModel, {
	namespace: '${namespace}',

	state: {
		filterItem:{}
	},

	subscriptions: {
		
	},

	effects: {
		*query({ payload = {} }, { call, put, select }) {
			const data = yield call(queryPartDataList,payload)
			const {error,result}=data
			if (!error) {
				yield put({
					type: 'querySuccess',
					payload: {
						list: result.rows,
						pagination: {
							current: Number(payload.page) || 1,
							pageSize: Number(payload.pageSize) || 10,
							total: result.total,
						},
					},
				})
			}
		},

	},

	reducers: {

	},
})
